package com.bbzn.device.client.service.emq.smoke;

import com.bbzn.device.client.constant.TitleConstant;
import com.bbzn.device.client.service.impl.cwting.BaseCwtingService;
import org.springframework.stereotype.Component;

import java.text.MessageFormat;

/**
 * @Author wulongbo
 * @Date 2021/9/10 15:50
 * @Version 1.0
 */

@Component
public class EmqSmokeLowBatteryStrategy extends BaseCwtingService implements SmokeStrategy {

    @Override
    public void dealAlarm(String code, String imei) throws Exception {
        // 报警类型（1：设备上线 /  2：设备离线 / 3：围栏正常 / 4：围栏异常/ 5：手环脱落 / 6：手表佩戴 / 7：血压预警  / 8：心率预警 / 9：温度预警 /10：烟雾报警 /11：低电压报警/12：烟雾感应报警 /13：血氧预警 /14：防拆报警 / 15：报警恢复）
        Integer alarmType = 11;
        String cnSign = MessageFormat.format("异常消息：设备号为【{0}】的设备电量过低", imei);
        String enSign = MessageFormat.format("exception message: the power of the device with device number {0} is too low ", imei);
        String title = TitleConstant.LOW_POWER_ALARM;
        String enTitle = TitleConstant.LOW_POWER_ALARM_EN;
        this.common(code, imei, cnSign, enSign, alarmType, title, enTitle);
    }
}
